#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
import talkie
DEBUG = False

def debug(data):
    if DEBUG:
        print "DEBUG: " + str(data).decode('iso-8859-1').encode('utf8')

class console:
    quit = False
    PS1  = "     #: "
    PS2  = "Talkie: "
    def __init__(self):
        print "\nWrite the following for special actions:\n"
        print "quit    Quit this program."
        print "rec     Start the learning."
        print "stop    Stop the learning.\n"

    def debug(self, data):
        debug(data)
        
    def read(self):
        input = raw_input(self.PS1)
        if input.lower() == "quit":
            self.quit = True
            self.write("Bye bye.")
            return ""
        elif input.lower() == "rec":
            talkie.RECORD = True
            self.write("Turned on learning sence.")
            input = raw_input(self.PS1)
        elif input.lower() == "stop":
            talkie.RECORD = False
            self.write("Turned off learning sence.")
            input = raw_input(self.PS1)
   
        return input.decode('utf8').encode('iso-8859-1')

    def write(self, data):
        if data:
            print self.PS2 + str(data).decode('iso-8859-1').encode('utf8')